﻿using ZeroSum.Models;

namespace ZeroSum.Exceptions;

public class BusinessException : Exception
{
    protected BusinessException(string message, ResponseStatus status) : base(message)
    {
        Status = status;
    }

    public ResponseStatus Status { get; }

    public static BusinessException Of(string message, ResponseStatus status)
    {
        return new BusinessException(message, status);
    }
}

/// <summary>
/// 自定义异常
/// </summary>
public class CustomException : Exception
{
    protected CustomException(int code, string message) : base(message)
    {
        Code = code;
    }

    public int Code { get; }

    public static CustomException Of(int code, string message)
    {
        return new CustomException(code, message);
    }
}